home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / indexing / IXAttributeReader.h < prev    next >
Text File  |  1994-04-13  |  3KB  |  79 lines

  1. /*
  2. IXAttributeReader.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    <objc/Object.h>
  7. #import    <objc/hashtable.h>
  8.  
  9. @class List;
  10.  
  11. // This protocol is adopted by subclasses that wish to perform special case 
  12. // folding or lexeme extraction.  The IXJapaneseLexer in the Kanji version of 
  13. // the library is a case in point, since the Kanji encodings involve shifting
  14. // between one and two by character representations.
  15.  
  16. @protocol IXLexemeExtraction
  17.  
  18. - (unsigned)foldCase:(char *)string inLength:(unsigned)length;
  19. - (unsigned)getLexeme:(char *)string inLength:(unsigned)length 
  20.     fromStream:(NXStream *)stream;
  21.  
  22. @end
  23.  
  24. @interface IXAttributeReader: Object
  25. {
  26.     NXHashTable        *stopWords; // these words removed from output
  27.     const char         *punctuation; // characters that delimit words
  28.     unsigned char    *charMapping; // table for mapping characters
  29.     struct        {
  30.     unsigned    caseFolding:1; // fold upper case to lower case
  31.     unsigned    pluralFolding:1; // fold plural to singular form
  32.     unsigned    stemsReduced:1; // reduce words to their stems
  33.     unsigned    tokenUniquing:1; // unique tokens to pack output
  34.     }             booleanOptions;
  35. }
  36.  
  37. // analyzes a stream, returning Attribute Reader Format.
  38. - (NXStream *)analyzeStream:(NXStream *)stream;
  39.  
  40. - (unsigned)foldPlural:(char *)string inLength:(unsigned)length;
  41. - (unsigned)reduceStem:(char *)string inLength:(unsigned)length;
  42.  
  43. @end
  44.  
  45. @interface IXAttributeReader(Configuration)
  46.  
  47. - (BOOL)isCaseFolded; // true if case folding enabled
  48. - setCaseFolded:(BOOL)flag; // enables or disables case folding
  49.  
  50. - (BOOL)arePluralsFolded; // true if plural folding enabled
  51. - setPluralsFolded:(BOOL)flag; // enables or disables plural folding
  52.  
  53. - (BOOL)areStemsReduced; // true if stem removal enabled
  54. - setStemsReduced:(BOOL)flag; // enables or disables stem removal
  55.  
  56. - (char *)punctuation; // returns currently defined token delimiters
  57. - setPunctuation:(const char *)string; // sets token delimiters
  58.  
  59. - (char *)stopWords; // returns newline delimited stop word string
  60. - setStopWords:(const char *)string; // sets stop words
  61.  
  62. - readStopWords:(NXStream *)stream; // reads stop words from a stream
  63. - writeStopWords:(NXStream *)stream; // writes stop words to a stream
  64.  
  65. - readStopWordsFromFile:(const char *)filename; // reads stop words from a file
  66. - writeStopWordsToFile:(const char *)filename; // writes stop words to a file
  67.  
  68. @end
  69.  
  70. // The following protocol is obselete, and may be not be defined in future 
  71. // releases.  The methods are now declared by the classes that implement them.
  72.  
  73. @protocol IXAttributeReading
  74.  
  75. - (NXStream *)analyzeStream:(NXStream *)stream;
  76.  
  77. @end
  78.  
  79.